/*
 * Instruction53.java
 *
 * Created on March 21, 2007, 9:47 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package moto9s12sim;

/**
 *
 * @author Fergus Earnshaw
 */
public class Instruction53 extends Instruction{
    
    /** Creates a new instance of Instruction53 */
  public Instruction53()
    {
        this.strAssemblyCode = "DECB";
        this.bCodes = new byte[1];
        this.bCodes[0] = (byte)Integer.parseInt("53",16);
    }
    
    public boolean excute(M9S12 cpu)
    {
        this.shAddr = cpu.PC.getRegister();
        byte bB = cpu.B.getRegister();
        cpu.B.dec();
        cpu.PC.inc();
        
        cpu.CC.setN(cpu.B.getRegister() < 0);
        
        cpu.CC.setZ(cpu.B.getRegister() == 0);
        
        cpu.CC.setV(bB == (byte)0x80);
        printInstruction(cpu);
        return true;
    }    
}
